{extend name="$adminPage"}

{block name="headStyle"}
<style type="text/css">

</style>
{/block}

{block name="content"}
<table id="auth_list"></table>
<script type="text/javascript">
    layui.use(["jquery", 'yunj', 'table', 'treeTable'], function () {
        let win = window;
        let doc = document;
        let $ = layui.jquery;
        let treeTable = layui.treeTable;

        class AuthManage {

            constructor() {
                this.init();
            }

            init() {
                let that = this;

            }

            renderTable() {
                let that = this;
                let args = {
                    elem: '#auth_list',
                    url: that.table.url,
                    method: 'post',
                    contentType: 'application/json',
                    parseData: function (res) {
                        let data = res.data;
                        let items = yunj.isObj(data) && data.hasOwnProperty('items') && data.items ? data.items : [];
                        items.map(item => {
                            item.is_export = false;
                            return item;
                        });
                        that.items = items;
                        return {
                            "code": res.errcode,
                            "msg": res.msg,
                            "count": that.itemsCount,
                            "data": that.items
                        };
                    },
                    loading: true,
                    text: {none: '暂无相关数据'},
                    autoSort: false,
                    defaultToolbar: [],
                    cols: [],
                    done: function (res) {
                        table.resize(this.id);
                    }
                };
            }

        }

        // $(doc).ready(function (e) {
        //     new AuthManage();
        // });

        treeTable.render({
            elem: '#auth_list',
            url: '/menus.json',
            tree: {
                view:{
                    iconClose:'',
                    iconOpen:'',
                    iconLeaf:''
                }
            },
            cols: [
                [
                    {type: 'checkbox', fixed: 'left'},
                    {field: 'name', title: '用户名', fixed: 'left'},
                    {field: 'experience', title: '积分', sort: true},
                    {field: 'sex', title: '性别', sort: true},
                    {field: 'score', title: '评分', sort: true},
                    {field: 'city', title: '城市'},
                ]
            ]
        });

    });
</script>
{/block}